;; Sonic R Improvement Mod CODES + ORIGINAL CHEATS
;;(TO EDIT THIS UNCHECK READ ONLY IN PROPERTIES! WE GOTTA MAKE SURE UPDATES DON'T OVERRIDE THIS JUST IN CASE!)

Code "Max Rings (Player 1)"
write16 007B73A0 999

Code "Low Time (Player 1)"
write16 007B73D8 0
write16 007B73DC 0
write16 007B73E0 0

Code "Always Have Speed Shoes (Player 1)"
write8 007B7410 255

Code "Always Have Electic Shield (Player 1)"
write8 007B740B 4

Code "Always Have Bubble Shield (Player 1)"
write8 007B740B 255

Code "Always Come in 1st Place (Player 1)"
write8 007B73E4 1
write8 007B7B00 1

Code "Amy Boost Always Ready (Player 1)"
ifeq8 007B747A 3
	ifeq8 007B7407 0
		write8 007B7406 0
	else
		ifltequ8 007B7406 44
			write8 007B7407 0
		endif
	endif
endif

Code "Eggman/EggRobo Missile Always Ready (Player 1)"
ifeq8 007B747A 4
	ifltu16 007B73A0 10
		write16 007B73A0 10
	endif
	write8 007B7406 0
endif
ifeq8 007B747A 8
	ifltu16 007B73A0 10
		write16 007B73A0 10
	endif
	write8 007B7406 0
endif

Code "Have 5/5 Sonic Tokens"
write8 0075356C 5

Code "Have 0/5 Sonic Tokens"
write8 0075356C 0

Code "Unlock All Characters, Stages, and Emeralds"
ifeq8 00752BDC 0
	write8 00752BDC 1
endif
ifeq8 00752BF0 1
	write8 00752BF0 2
endif
write8 00752BF4 2
write8 00752BF8 2
write8 00752BFC 2
write8 00752C00 2
write8 00752C04 2
write8 00752C08 2
write8 00752C0C 2
write8 00752C10 2
write8 00752C14 2
write8 00752C18 2
write8 00752C1C 2
write8 00752C20 2

Code "Always Have Current Stage Chaos Emeralds"
write8 00769F28 3

Code "Never Have Current Stage Chaos Emeralds"
write8 00769F28 0

Patch "Practice Mode (Tokens/Emeralds Always Spawn)"
writenop 004279BC 7
writenop 0043E777 8
writenop 00427A05 6
write8 00427A3D 0xEB
write8 00427A29 0xEB
write8 00427A54 0xEB
write8 00427A69 0xEB
writenop 00427A79 6
write8 00427A94 0xEB

Patch "Easy Balloon Mode (All 17 Balloons Always Spawn)"
writenop 00422848 6

Code "Hard Balloon Mode (Need All 17 Balloons!)"
ifeq8 007BCB80 3
	ifeq8 007356EC 1
		write32 0043950A 17
		write32 00422853 13
		write8 0043E85B 5
	else
		write32 0043950A 5
		write32 00422853 1
		write8 0043E85B 3
	endif
endif

Code "Press P to Freeze CPUs"
ifne8 007356E1 3
	ifeq8 007356EC 1
		ifeq8 007BCB80 2
		else
			ifkbkey 00000000 P
				write8 007B7C64 2
				write8 007B8380 2
				write8 007B8A9C 2
				write8 007B91B8 2
			endif
		endif
	endif
endif

Patch "Disable Demo Recording"
write8 00444720 0xC3

Patch "Players Never Sink Into Water"
writenop 00429C78 3
writenop 00429B01 6

Patch "Always use Saturn/DirectDraw Camera Angle"
writenop 00405345 6

Patch "Ring Gates Don't Take Away Rings"
writenop 00441C83 4
writenop 00441C69 4

Patch "Ring Gates Are Free"
writenop 00441BA3 6
writenop 00441C83 4
writenop 00441C69 4

Patch "Accelerators Don't Take Away Rings"
writenop 00428719 7
writenop 00428735 7

Patch "Accelerators Are Free"
writenop 004286D6 2
write8 00428714 0xEB
writenop 00428735 7

;; Tweaked to be the version from the improvement mod
Code "Knuckles CPU instead of Super Sonic CPU"
;; If No. of Controlled Players is 1 
ifeq8 007356EC 1
	;; And Player 2 is Super Sonic 
	ifeq8 007B7B96 9
		;; And Player 1 isn't Knuckles
		ifne8 007B747A 2
			;; Then Change Super Sonic to Knuckles 
			write8 007B7B96 2
			write8 007B7C84 2
		else
			;; Then Change Super Sonic to Sonic 
			write8 007B7B96 0
			write8 007B7C84 0
		endif
	endif
endif

Patch "Sonic Can Double Jump Infinitely"
write16 0042C6E7 0

Patch "Tails Can Fly Forever"
write16 0042C73C 0xE990

Patch "Always Race Against Easy Opponents"
writenop 004300F6 2

Patch "Race Opponents Don't Need Unlock"
writenop 00430147 2

Patch "Disable HUD"
write8 0043A2D2 0xEB

Patch "Disable Flashing Press Start Graphic"
write8 0043D327 0xEB

Patch "Cinematic Camera Always Disabled"
writenop 0043B8D9 2

Patch "Cinematic Camera Always Enabled"
write8 0043B8D9 0xEB

Code "Max Rings (Player 2)"
write16 007B7ABC 999

Code "Low Time (Player 2)"
write16 007B7AF4 0
write16 007B7AF8 0
write16 007B7AFC 0

Code "Always Have Speed Shoes (Player 2)"
write8 007B7B2C 255

Code "Always Have Electic Shield (Player 2)"
write8 007B7B27 4

Code "Always Have Bubble Shield (Player 2)"
write8 007B7B27 255

Code "Amy Boost Always Ready (Player 2)"
ifeq8 007B7B96 3
	ifeq8 007B7B23 0
		write8 007B7B22 0
	else
		ifltequ8 007B7B22 44
			write8 007B7B23 0
		endif
	endif
endif

Code "Eggman/EggRobo Missile Always Ready (Player 2)"
ifeq8 007B7B96 4
	ifltu16 007B7ABC 10
		write16 007B7ABC 10
	endif
	write8 007B7B22 0
endif
ifeq8 007B7B96 8
	ifltu16 007B7ABC 10
		write16 007B7ABC 10
	endif
	write8 007B7B22 0
endif

Code "Max Rings (Player 3)"
write16 007B81D8 999

Code "Low Time (Player 3)"
write16 007B7210 0
write16 007B7214 0
write16 007B7218 0

Code "Always Have Speed Shoes (Player 3)"
write8 007B8248 255

Code "Always Have Electic Shield (Player 3)"
write8 007B8243 4

Code "Always Have Bubble Shield (Player 3)"
write8 007B8243 255

Code "Amy Boost Always Ready (Player 3)"
ifeq8 007B82B2 3
	ifeq8 007B823F 0
		write8 007B823E 0
	else
		ifltequ8 007B823E 44
			write8 007B823F 0
		endif
	endif
endif

Code "Eggman/EggRobo Missile Always Ready (Player 3)"
ifeq8 007B82B2 4
	ifltu16 007B81D8 10
		write16 007B81D8 10
	endif
	write8 007B823E 0
endif
ifeq8 007B82B2 8
	ifltu16 007B81D8 10
		write16 007B81D8 10
	endif
	write8 007B823E 0
endif

Code "Max Rings (Player 4)"
write16 007B88F4 999

Code "Low Time (Player 4)"
write16 007B792C 0
write16 007B7930 0
write16 007B7934 0

Code "Always Have Speed Shoes (Player 4)"
write8 007B8964 255

Code "Always Have Electic Shield (Player 4)"
write8 007B895F 4

Code "Always Have Bubble Shield (Player 4)"
write8 007B895F 255

Code "Amy Boost Always Ready (Player 4)"
ifeq8 007B89CE 3
	ifeq8 007B895B 0
		write8 007B895A 0
	else
		ifltequ8 007B895A 44
			write8 007B895B 0
		endif
	endif
endif

Code "Eggman/EggRobo Missile Always Ready (Player 4)"
ifeq8 007B89CE 4
	ifltu16 007B88F4 10
		write16 007B88F4 10
	endif
	write8 007B895A 0
endif
ifeq8 007B89CE 8
	ifltu16 007B88F4 10
		write16 007B88F4 10
	endif
	write8 007B895A 0
endif

Code "Max Rings (Player 5)"
write16 007B9010 999

Code "Low Time (Player 5)"
write16 007B7048 0
write16 007B704C 0
write16 007B7050 0

Code "Always Have Speed Shoes (Player 5)"
write8 007B9080 255

Code "Always Have Electic Shield (Player 5)"
write8 007B907B 4

Code "Always Have Bubble Shield (Player 5)"
write8 007B907B 255

Code "Amy Boost Always Ready (Player 5)"
ifeq8 007B90EA 3
	ifeq8 007B9077 0
		write8 007B9076 0
	else
		ifltequ8 007B9076 44
			write8 007B9077 0
		endif
	endif
endif

Code "Eggman/EggRobo Missile Always Ready (Player 5)"
ifeq8 007B90EA 4
	ifltu16 007B9010 10
		write16 007B9010 10
	endif
	write8 007B9076 0
endif
ifeq8 007B90EA 8
	ifltu16 007B9010 10
		write16 007B9010 10
	endif
	write8 007B9076 0
endif

Code "Sonic R & Knuckles"
write8 007B747A 2
write8 007B7568 2
write8 007B7B96 2
write8 007B7C84 2
write8 007B82B2 2
write8 007B83A0 2
write8 007B89CE 2
write8 007B8ABC 2
write8 007B90EA 2
write8 007B91D8 2

;; Sonic R Improvement Mod CODES (Added to existing codes for advanced users)

;; Added by showin for "All Codes" version only

Code "Fix No Control On Startup For Keyboard (can cause crash if keyboard isn't plugged in)"
write8 004A4578 1

Code "Fix No Control On Startup For Controller (can cause crash if controller isn't plugged in)"
write8 004A3AE0 1

;; Sonic R Improvement Mod CODES
;;(TO EDIT THIS UNCHECK READ ONLY IN PROPERTIES! WE GOTTA MAKE SURE UPDATES DON'T OVERRIDE THIS JUST IN CASE!)
;; Some codes come from the original code list. Many are removed so players can easily check all codes without a hassle.
;; General Tweaks (Strictly improves vanilla game.)

Patch "Players Can Choose Same Character"
write8 00430023 0xEB

Patch "Always Race Against Hard Opponents"
write8 004300F6 0xEB

Patch "Disable Menu Timeouts"
write8 0042E7C0 0xEB
write8 0042F37C 0xEB
write8 0042F8FC 0xEB
write8 00430C0B 0xEB
write8 00431CFD 0xEB
write8 004326AC 0xEB
write8 004345AC 0xEB
writenop 0043445F 6
write8 00434689 0xEB
write8 00438343 0xEB

Patch "Gems Collection Cursor Speeds"
write8 0042E8D8 0x0C
write8 0042E8DF 0x0C
write8 0042F463 0x0C
write8 0042F46A 0x0C
write8 0042F9AD 0x0A
write8 0042F9B4 0x0A
write8 00430CFB 0x0C
write8 00430D02 0x0C
write8 0043045B 0x08
write8 0043046B 0xF8
write8 004383FF 0x0C
write8 00438406 0x0C
write8 00431D2C 0x0C
write8 00431D3C 0x0C

Code "Fast Screen Transitions"
write16 005F388C 50

Code "Boss Music"
;; If No. of Controlled Players is 1 
ifeq8 007356EC 1
	;; VS Boss?
	ifeq8 00769F24 3
		;; If not the final stage.
		ifne8 007AF13C 5
			;; Play Boss Music!
			write16 00502158 22
		endif
		
		;; If it is the final stage.
		ifeq8 007AF13C 5
			;; Play Boss Music!
			write16 00502158 23
		endif
		
	endif
endif

Code "Knuckles CPU instead of Super Sonic CPU"
;; If No. of Controlled Players is 1 
ifeq8 007356EC 1
	;; And Player 2 is Super Sonic 
	ifeq8 007B7B96 9
		;; And Player 1 isn't Knuckles
		ifne8 007B747A 2
			;; Then Change Super Sonic to Knuckles 
			write8 007B7B96 2
			write8 007B7C84 2
		else
			;; Then Change Super Sonic to Sonic 
			write8 007B7B96 0
			write8 007B7C84 0
		endif
	endif
endif

;; Significant Gameplay Tweaks (More subjective changes.)

Code "Buff Eggman/EggRobo Missiles"
;; If No. of Controlled Players is 1 
ifeq8 007356EC 1
	;;  Player isn't Amy
	ifne8 007B747A 3
	;;  Player isn't Eggman
	ifne8 007B747A 4
	;;  Player isn't Tails Doll
	ifne8 007B747A 6
	;;  Player isn't Egg Robo
	ifne8 007B747A 8
	;;  Player isn't Super Sonic
	ifne8 007B747A 9
		;; Is Player Hurt?
		ifeq8 007B7420 5
			;; Is Player In The Air?
			ifeq8 007B73FA 0
				;; Does Player Not Have A Shield?
				ifeq8 007B740A 0
					;; Slow them down
					write16 007B73F2 2
					;; Make them lose rings too. Fuck em!
					write16 007B73A0 0
				endif
				;; Does Player Have A Shield?
				ifne16 007B740A 0
					;; Lose Shield!
					write16 007B740A 0
					;; Don't do hurt animation!
					write16 007B7420 15
				endif
			endif
		endif
	endif	
	endif
	endif
	endif
	endif
endif

Patch "Eggman/EggRobo Missiles Don't Take Away Rings"
writenop 00428F72 5

Code "Eggman Final Boss"
;; Checks for the bosses to be beaten before unlocking the final stage!
;; Is Eggman Locked?
ifeq8 00752BF0 1
;; Is Metal Sonic unlocked?
ifeq8 00752BF4 2
	;; Is Tails Doll unlocked?
	ifeq8 00752BF8 2
		;; Is Metal Knux unlocked?
		ifeq8 00752BFC 2
			;; Is Egg Robo unlocked?
			ifeq8 00752C00 2
				;; Enable Final Boss! (Emeralds not required!)
				;; Not Time Attack?
				ifne8 00769F24 2
				;; Not Multiplayer either?
				ifne8 00769F24 1
					;;  If No. of Controlled Players is 1 
					ifeq8 007356EC 1
					;; If Stage is the final stage.
						ifeq8 004AFC7C 4
							;; Then Change Player 2 To Eggman 
							write8 007B7B96 4
							;;  Then Change It To 2 Players
							write8 0085DF28 2
							;;  Boss Mode Part 1 Enabled?
							ifeq8 00769F24 3
								write16 00769F24 4
							endif
						endif
					endif
					
					;; Is Cursor On Final Stage?
					ifeq8 00752850 4
						;; Then Enable VS!
						write16 00769F24 3
					endif
					
				endif
				endif
			endif
		endif
	endif
endif

;; Not Time Attack?
ifne8 00769F24 2
;; Not Multiplayer either?
ifne8 00769F24 1
					;; Is Cursor On stage 3?
					ifeq8 00752850 3
					;; Is Eggman locked?
						ifeq8 00752BF0 1
						;; Then Don't Enable VS!
						write16 00769F24 0
						;; Ensure player count is 5.
						write16 0085DF28 5
						endif
					endif
					
					;; Is Cursor On stage 2?
					ifeq8 00752850 2
						;; Is Eggman locked?
						ifeq8 00752BF0 1
						;; Then Don't Enable VS!
						write16 00769F24 0
						;; Ensure player count is 5.
						write16 0085DF28 5
						endif
					endif
					
					;; Is Cursor On stage 1?
					ifeq8 00752850 1
						;; Is Eggman locked?
						ifeq8 00752BF0 1
						;; Then Don't Enable VS!
						write16 00769F24 0
						;; Ensure player count is 5.
						write16 0085DF28 5
						endif
					endif
					
					;; Is Cursor On stage 0?
					ifeq8 00752854 12
						;; Is Eggman locked?
						ifeq8 00752BF0 1
						;; Then Don't Enable VS!
						write16 00769F24 0
						;; Ensure player count is 5.
						write16 0085DF28 5
						endif
					endif
endif
endif

;; Is Metal Sonic not unlocked?
ifeq8 00752BF4 0
	;; Lock Final Stage
	write16 00752BDC 0
endif

;; Is Tails Doll not unlocked?
ifeq8 00752BF8 0
	;; Lock Final Stage
	write16 00752BDC 0
endif

;; Is Metal Knux not unlocked?
ifeq8 00752BFC 0
	;; Lock Final Stage
	write16 00752BDC 0
endif

;; Is Egg Robo not unlocked?
ifeq8 00752C00 0
	;; Lock Final Stage
	write16 00752BDC 0
endif

;; If they're all unlocked and the player beat each race make sure Radiant Emerald Is Unlocked.
;; Don't like doing it this way but the codeloader is a bit restricting.
ifne8 00752BDC 2
	ifeq8 00752BF4 2
	ifeq8 00752BF8 2
		ifeq8 00752BFC 2
			ifeq8 00752C00 2
				ifeq8 00752BCC 2
					ifeq8 00752BD0 2
						ifeq8 00752BD4 2
							ifeq8 00752BD8 2
								write16 00752BDC 1
							endif
						endif
					endif
				endif
			endif
		endif
	endif
	endif
endif


endif

Code "Super Sonic Tweaks"
;; Player is Super Sonic.
ifeq8 007B747A 9
	;; Not in time attack.
	ifne8 00769F24 2
		;; If Beginning Of Race 
		ifeq8 007B7425 109
			;; Then Buff To Have Starting Rings  
			write16 007B73A0 50
		endif
		
		;; Has the race actually started?
		ifne16 007B73D8 0
			;; Does the player have more than 0 rings?
			ifne16 007B73A0 0
				;;If 1 second has passed.
				ifeq16 00752850 0
					;; Then Subtract 1 Ring!
					sub16 007B73A0 1
				endif
			endif
		endif	
	endif

;; Buff To Go Fast Through Loops  
write32 007B7458 500000	
endif

Code "Make Metal Bosses More Engaging"
;; If No. of Controlled Players is 1 
ifeq8 007356EC 1
	;; VS Boss? (player count is 2)
	ifeq8 0085DF28 2
		;; If not the final stage. (eggman is already a decent challenge)
		ifne8 007AF13C 5
			;; Make sure the game isn't paused.
			ifne8 007C1BC0 1
				;; Is enemy not on the final lap?
				ifne8 007B7B02 2
				
					;; If Player is in first.
					ifeq8 007B73E4 1
						;; If the bots are going less than 160.
						ifltequ8 0047EA88 160
							;; Then buff speed.
							add8 0047EA88 1
						endif	
					endif
		
					;; If Player is in 2nd or worse.
					ifgtequ8 007B73E4 2
						;; If the bots are going more than 80.
						ifgtequ8 0047EA88 80
							;; Then nerf speed.
							sub8 0047EA88 1
						endif	
					endif
					
				else
				
					;; If Player is in first.
					ifeq8 007B73E4 1
						;; If the bots are going less than 130.
						ifltequ8 0047EA88 130
							;; Then buff speed.
							add8 0047EA88 1
						endif	
					endif
		
					;; If Player is in 2nd or worse.
					ifgtequ8 007B73E4 2
						;; If the bots are going more than 55.
						ifgtequ8 0047EA88 55
							;; Then nerf speed.
							sub8 0047EA88 2
						endif	
					endif
				
				endif
			endif
		endif
	endif
endif

Code "Dynamic Difficulty"
;; Are we racing the Hard Opponents?
ifeq8 004300F6 235
;; If No. of Controlled Players is 1 
ifeq8 007356EC 1
	;; If No. of Total Players is 5
	ifeq8 0085DF28 5
	
		;; Resort Island!
		ifeq8 007AF13C 0
			;; And Metal Knux is unlocked.
			ifeq8 00752BFC 2
				;; And Tails is unlocked.
				ifeq8 00752BF8 2
					;; And Egg Robo is unlocked.
					ifeq8 00752C00 2
						;; And finally Metal Sonic isn't.
						ifeq8 00752BF4 0 
							;; Do we got all the medals?
							ifeq8 0075356C 5
								;; Are we on the third lap?
								ifeq8 007B73E6 2
									;; Are we doing shitty?
									ifltequ8 007B73E4 4
										;; Nerf the ai.
										write8 0047EA88 60	
									endif
								endif
							endif
						else
							;; Do we got an emerald?
							ifgtu8 00769F28 0
								;; Are we on the third lap?
								ifeq8 007B73E6 2
									;; Are we doing shitty?
									ifeq8 007B73E4 5
										;; Nerf the ai.
										write8 0047EA88 60	
									endif
								endif
							endif
						endif
					endif
				endif
			endif
		endif
		
		;; Radical City!
		ifeq8 007AF13C 1
			;; And Metal Knux is unlocked.
			ifeq8 00752BFC 2 
				;; And Metal Sonic is unlocked.
				ifeq8 00752BF4 2
					;; And Egg Robo is unlocked.
					ifeq8 00752C00 2
						;; And finally Tails doll isn't.
						ifeq8 00752BF8 0 
							;; Do we got all the medals?
							ifeq8 0075356C 5
								;; Are we on the third lap?
								ifeq8 007B73E6 2
									;; Are we doing shitty?
									ifltequ8 007B73E4 4
										;; Nerf the ai.
										write8 0047EA88 60	
									endif
								endif
							endif
						else
							;; Do we got an emerald?
							ifgtu8 00769F28 0
								;; Are we on the third lap?
								ifeq8 007B73E6 2
									;; Are we doing shitty?
									ifeq8 007B73E4 5
										;; Nerf the ai.
										write8 0047EA88 60	
									endif
								endif
							endif
						endif
					endif
				endif
			endif
		endif
		
		;; Regal Ruin!
		ifeq8 007AF13C 2
			;; And Metal Knux is unlocked.
			ifeq8 00752BFC 2 
				;; And Metal Sonic is unlocked.
				ifeq8 00752BF4 2
					;; And Tails doll is unlocked.
					ifeq8 00752BF8 2
						;; And finally egg robo isn't.
						ifeq8 00752C00 0  
							;; Do we got all the medals?
							ifeq8 0075356C 5
								;; Are we on the third lap?
								ifeq8 007B73E6 2
									;; Are we doing shitty?
									ifltequ8 007B73E4 4
										;; Nerf the ai.
										write8 0047EA88 60	
									endif
								endif
							endif
						else
							;; Do we got an emerald?
							ifgtu8 00769F28 0
								;; Are we on the third lap?
								ifeq8 007B73E6 2
									;; Are we doing shitty?
									ifeq8 007B73E4 5
										;; Nerf the ai.
										write8 0047EA88 60	
									endif
								endif
							endif
						endif
					endif
				endif
			endif
		endif
		
		;; Reactive Factory!
		ifeq8 007AF13C 3
			;; And Metal Sonic is unlocked.
			ifeq8 00752BF4 2
				;; And Tails is unlocked.
				ifeq8 00752BF8 2
					;; And Egg Robo is unlocked.
					ifeq8 00752C00 2
						;; And finally Metal Knux isn't.
						ifeq8 00752BFC 0
							;; Do we got all the medals?
							ifeq8 0075356C 5
								;; Are we on the third lap?
								ifeq8 007B73E6 2
									;; Are we doing shitty?
									ifltequ8 007B73E4 4
										;; Nerf the ai.
										write8 0047EA88 60
									endif
								endif
							endif
							
							;; And Player 4 is EggRobo 
							ifeq8 007B89CE 8
								;; And Eggman is locked
								ifeq8 00752BF0 1
									;; Then Change EggRobo to Eggman (this is kinda needed to make things easier in this stage)
									write8 007B89CE 4
									write8 007B8ABC 4
								endif
							endif
						else
							;; Do we got an emerald?
							ifgtu8 00769F28 0
								;; Are we on the first lap?
								ifeq8 007B73E6 0
									;; Are we doing shitty?
									ifeq8 007B73E4 5
										;; Nerf the ai.
										write8 0047EA88 65	
									endif
								else
									;; Are we on the second lap?
									ifeq8 007B73E6 1
										;; Are we doing shitty?
										ifeq8 007B73E4 5
											;; Nerf the ai.
											write8 0047EA88 60	
										endif
									else
										;; Are we on the third lap?
										ifeq8 007B73E6 2
											;; Are we doing shitty?
											ifeq8 007B73E4 5
												;; Nerf the ai.
												write8 0047EA88 55	
											endif
										endif
									endif
								endif
							endif
						endif
					endif
				endif
			endif
		endif
		
	endif
endif
endif

Code "Add Practice Stage (HOLD L/R WHEN SELECTING RESORT ISLAND)"
;; If No. of Controlled Players is 1 
ifeq8 007356EC 1
	;; We really in the menus?
	ifeq8 007356E1 3
		;; Is this the course selection menu?
		ifeq8 00752858 12
			;; Are Trigger buttons pressed?
			ifgtequ8 0072DFB4 1
				;; Is A button pressed?
				ifeq8 0073569C 2 
					;; Force Skybox Change
					write32 00459EC4 7021725558563435892
					write32 00459F18 7021725558563435892
					write32 00459F6C 7021725558563435892
					;; Force Hud Map file change
					write32 0045A050 7021725562858403188
					;; Force Map File Change
					write32 00459FF8 7020318192269817204
					;; Force ply file change
					write32 0045A00C 7813796155912123764
					;; Force Collision Change
					write32 00459FCC 7310518901848438132
					;; Force Level to Island
					write8 007AF13C 1
					;; Force Time Attack Save Change
					write8 00456FCC 102
					write8 00456FC0 102
					write8 00456FB0 102
					write8 00456FA8 102
					write8 00456F98 102
					write8 00456F8C 102
					write8 00456F80 102
					write8 00456F74 102
					write8 00456F68 102
					write8 00456F5C 102
				endif
			endif
		endif
	endif
endif
;; If Tutorial is activated.
ifeq32 00459EC4 7021725558563435892
	ifeq8 007AF13C 1
		;; Force graphical terrian to be off 
		write32 00769C40 0
		;; Fix camera.
		write8 004053C5 90
		write8 00405370 90
		;; Make player count 1!
		write8 0085DF28 1
		;; Force gamemode to time attack
		write16 00769F24 2	
		write16 007BCB80 0	
		;; Play tutorial music
		write16 00502158 24
	endif
;; If tutorial is completed then do this. (Finished 3 laps)
ifeq8 007af13c 0
			;; Force Skybox Change
			write32 00459EC4 8096456655348986729
			write32 00459F18 8096456655348986729
			write32 00459F6C 8096456655348986729
			;; Force Hud Map file change
			write32 0045A050 7880283873235202921
			;; Force Map File Change
			write32 00459FF8 7592053497083491177
			;; Force ply file change
			write32 0045A00C 7592053497083491177
			;; Force Collision Change
			write32 00459FCC 8247349194359990626
			;; Make player count 5!
			write8 0085DF28 5
			;; Force gamemode to back to normal
			write16 00769F24 0
			;; Revert Camera Back
			write8 004053C5 64
			write8 00405370 64			
endif
;; If tutorial is completed then do this. (Made it back to the menus with the ghost names changed.)
ifeq8 00456FCC 102
	;; Are we in menus.
	ifeq8 007356E1 3
	;; The main menu after time trial?
	ifeq32 0054B584 990057071
		;; Then fix the ghost names.
		write8 00456FCC 115
		write8 00456FC0 116
		write8 00456FB0 75
		write8 00456FA8 65
		write8 00456F98 82
		write8 00456F8C 77
		write8 00456F80 68
		write8 00456F74 77
		write8 00456F68 77
		write8 00456F5C 83
	endif
	endif
endif
endif